package cn.ecut.listener;

import java.awt.*;
import java.awt.event.WindowAdapter;
import java.awt.event.WindowEvent;
import java.awt.event.WindowListener;

/**
 * @Author ruanxin
 */
public class TestPanel {
    public static void main(String[] args) {
        Frame frame = new Frame("我是个假窗口");//创建一个窗体
        Panel panel= new Panel(null);//创建一个面板
        frame.setLayout(null);

        frame.setBounds(300,500,300,500);
        frame.setBackground(new Color(0,0,250));
        panel.setBounds(50,50,200,200);
        panel.setBackground(new Color(0,200,3));

        frame.add(panel);

        frame.setVisible(true);

        //监听事件，监听关闭事件
        frame.addWindowListener(new WindowAdapter() {
            @Override
            public void windowClosing(WindowEvent e) {
                super.windowClosing(e);
            }
        });
    }
}
